void QuickSortSon(vector<int> &arr1, int l, int r)
{
	if (l >= r)
	{
		return;
	}

	int base = arr1[(l + r) / 2];
	int i = l;
	int j = r;
	while (i <= j)
	{
		while (arr1[i] < base)
		{
			i++;
		}
		while (arr1[j] > base)
		{
			j--;
		}

		if (i <= j)
		{
			int tmp = arr1[i];
			arr1[i] = arr1[j];
			arr1[j] = tmp;
			i++; 
			j--;
		}

	}

	QuickSortSon(arr1, l, j); //注意index是-1和+1
	QuickSortSon(arr1, i, r);
}

void QuickSort(vector<int> &arr1, int length)
{
//

	SimplePrint(arr1, length, "原始数据：");

	QuickSortSon(arr1, 0, length-1);

	SimplePrint(arr1, length, "排序后的数据：");
	return;
}



int main()
{

	vector<int> arr = {32,4,-2,45,6,10,32,100,10};
	//简单排序，双循环遍历
	//SimpleSort(arr,arr.size());
	//BublingSort(arr, arr.size());
	QuickSort(arr, arr.size());
	//QuickSort();
	return 0;
}